// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Cluster
{
	public sealed partial class CommandMoveAction
	{
		[JsonInclude]
		[JsonPropertyName("from_node")]
		public string FromNode { get; set; }

		[JsonInclude]
		[JsonPropertyName("index")]
		public Elastic.Clients.Elasticsearch.IndexName Index { get; set; }

		[JsonInclude]
		[JsonPropertyName("shard")]
		public int Shard { get; set; }

		[JsonInclude]
		[JsonPropertyName("to_node")]
		public string ToNode { get; set; }
	}

	public sealed partial class CommandMoveActionDescriptor : SerializableDescriptorBase<CommandMoveActionDescriptor>
	{
		internal CommandMoveActionDescriptor(Action<CommandMoveActionDescriptor> configure) => configure.Invoke(this);
		public CommandMoveActionDescriptor() : base()
		{
		}

		private string FromNodeValue { get; set; }

		private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; }

		private int ShardValue { get; set; }

		private string ToNodeValue { get; set; }

		public CommandMoveActionDescriptor FromNode(string fromNode)
		{
			FromNodeValue = fromNode;
			return Self;
		}

		public CommandMoveActionDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index)
		{
			IndexValue = index;
			return Self;
		}

		public CommandMoveActionDescriptor Shard(int shard)
		{
			ShardValue = shard;
			return Self;
		}

		public CommandMoveActionDescriptor ToNode(string toNode)
		{
			ToNodeValue = toNode;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			writer.WritePropertyName("from_node");
			writer.WriteStringValue(FromNodeValue);
			writer.WritePropertyName("index");
			JsonSerializer.Serialize(writer, IndexValue, options);
			writer.WritePropertyName("shard");
			writer.WriteNumberValue(ShardValue);
			writer.WritePropertyName("to_node");
			writer.WriteStringValue(ToNodeValue);
			writer.WriteEndObject();
		}
	}
}